home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / Pict2Ascii 1.03 / Panes / LDynamicPopupMenu / LDynamicPopupMenu.h < prev   
Encoding:
Text File  |  1997-05-21  |  2.4 KB  |  63 lines  |  [TEXT/CWIE]

  1. // LDynamicPopupMenu.h
  2. //        written by Constantine Spathis.
  3. //            No rights reserved, use and abuse at will!
  4. //            Thanks to the guys at Metrowerks who saved the Macintosh ( IMO :-) ) and to Greg Dow
  5. //            for creating such a cranking piece of software. And of course to Ron Liechty
  6. //            (hope I spelled that one correct) who must really be 10 guys from the way he
  7. //            keeps ontop of answering questions.
  8. //            
  9. //
  10. //        This class facilitates the creation of true(?) dynamic Pop-up menus within the 
  11. //        powerplant framework. The implementation is fairly straightforward, kill the control
  12. //        powerplant creates and create our own with the menuID mMenuID (making sure to 
  13. //        increment it). Please let me know of any improvements you make and any bugs you might
  14. //        find.
  15. //
  16. //        1/8/95        CS    Initial Iteration
  17. //        97/05/20        P. Lamboley
  18. //            I cannot read code if it's not presented my way, but the general idea is unchanged.
  19. //            The whole menu is now taken from the original, including disabled items aso : it
  20. //            avoids having to reconstruct it from scratch in the code. This is not done if a
  21. //            resource list has been specified in Constructor (PPob) : the menu items are added
  22. //            automatically when the control is created.
  23. //            The following are LOST from the PPob, because hidden in the undocumented part of
  24. //            the ControlHandle. They can be set explicitely with the class behavior calls :
  25. //                    * title justification (mValue for NewControl).
  26. //                            Defaults to popupTitleRightJust.
  27. //                            Valid values are :    enum {    popupTitleLeftJust        = 0x00000000,
  28. //                                                                    popupTitleCenterJust        = 0x00000001,
  29. //                                                                    popupTitleRightJust        = 0x000000FF };
  30. //                    * width of title (mMaxValue for NewControl)
  31. //                            Defaults to 0 (can't see the title)
  32. //                            Specifie a negative value to evaluate the width of the title at runtime
  33.  
  34. #include <LStdControl.h>
  35.  
  36. class LDynamicPopupMenu    : public LStdPopupMenu {
  37.  
  38. public:
  39.  
  40.     // Class ID Enumeration see Scott Meyers, Effective C++.
  41.     enum {
  42.         class_ID            = 'LDPM',
  43.         first_menu_ID    = 20000
  44.     };
  45.  
  46.     /* ctor */                        LDynamicPopupMenu (LStream*);
  47.     static LDynamicPopupMenu*    CreateLDynamicPopupMenuStream (LStream*);
  48.                         
  49.     // Set class behavior
  50.     void                                SetTitleWidth    (Int16);
  51.     void                                SetTitleJust    (Int16);
  52.  
  53.     //    Call this when you're done modifying things into the menu 
  54.     void                                FinishedCreatingMenu (Int32 initial_item);
  55.  
  56. private:
  57.  
  58.     static Int16                    mTitleWidth;
  59.     static Int16                    mTitleJust;
  60.     static Int16                    mMenuID;
  61.  
  62. };
  63.